<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>signup2 page</title>
    <script src="/jquery-3.4.1.min.js"></script>
    <style>
        .div1,.div2,.div3,.div4,.div5,.div6,.sign{
            margin: 20px;
            text-align: center;
            text-emphasis: black;

        }
        .signup{
            width:500px;
            margin: auto;
            border: 2px solid grey;
            height: 400px;
            background-image: url("./static/雪山.jpg");
            background-repeat: no-repeat;
            background-size: 150%;

        }
        .signin-btn{
            text-align: right;
            margin: 20px;
        }
    </style>
</head>
<body>
<form action="/user/signup" th:object="${userForm}">
    <div class="signup">
        <div class="signin-btn">
            <a href="signin.html">已有账号？登陆</a>
        </div>
        <div class="div4">
            <label >姓名</label>
            <input type="text" name="name"  th:field="*{name}" placeholder="请输入你的姓名">
            <p th:if="${#fields.hasErrors('name')}" th:errors="*{name}"></p>
        </div>
        <div class="div1">
            <label >邮箱</label>
            <input type="text" name="email" th:field="*{email}" placeholder="请输入工作邮箱">
            <input type="text" name="emailCode  ">
            <p th:if="${#fields.hasErrors('email')}" th:errors="*{email}"></p>
            <a href="#" id="getCode">获取验证码 </a>
            <p th:if="${#fields.hasErrors('emailCode')}" th:errors="*{emailCode}"></p>
        </div>
<!--        <div class="div2">-->
<!--            <label >验证码</label>-->
<!--            <input type="text" name="captcha" placeholder="输入验证码">-->
<!--        </div>-->
<!--        <div class="div3">-->
<!--            <label >邮箱验证</label>-->
<!--            <input type="text" name="mailbox" placeholder="请输入邮箱验证">-->
<!--            <a href="#">收不到邮件？</a>-->
<!--        </div>-->
        <div class="div5">
            <label >个性域名</label>
            <input type="text" name="domainname"  th:field="*{domainname}" placeholder="个性域名">
        </div>
        <div class="div6">
            <label >密码</label>
            <input type="password" name="password" th:field="*{password}" placeholder="密码不少于6位" >
            <p th:if="${#fields.hasErrors('password')}" th:errors="*{password}"></p>
        </div>
        <div   class="sign">
            <button type="submit">注册</button>
        </div>
    </div>
</form>
<script>
document.getElementById("getCode").addEventListener("click",function (ev) {
    var email=document.getElementById("email").value;
    fetch("/sendemail?email="+email);

})
</script>
</body>
</html>